<template>
	<view class="page">
		<scroll-view scroll-y="true" >
			<block v-for="(item,i) in typeList" :key="i">
				<view class="public_item w-100 pt-2 border-bottom border-light-secondary">
					<u-image width="100%" height="338rpx" lazy-load border-radius="4" :src="item.file1Path||errLoadImg" mode="scaleToFill" duration="1000">
						<image :src="loadingImg" style="width: 100%;height: 338rpx;"  slot="loading"></image>
						<image :src="errLoadImg" style="width: 100%;height: 338rpx;" slot="error"></image>
					</u-image>
					
					<view class="info pt-2 pb-3">
						<view class="title font-md font-weight">{{item.siteName}}</view>
						<view class="des da-center j-sb">
							<text class="text-muted font">{{item.siteSpace}} | {{item.siteAddress}}</text>
							<view class="font main-txtcolor main-border line-h p-1 rounded-10" @tap="goAppointment(item.id)">我要预约</view>
						</view>
					</view>
				</view>
			</block>
		</scroll-view>
	</view>
</template>

<script>
import { appointmentList } from '@/api/property/property.js';
export default {
	data() {
		return {
			typeList: [],
			loadingImg:'/static/images/timg.gif',
			errLoadImg:'/static/images/errLoad.jpeg',
		};
	},
	onReady() {
		this.setTypeList();
	},
	methods: {
		goAppointment(id){
			uni.navigateTo({
				url: '/pages/property/public_info/public_info?id='+id,
			});
		},
		async setTypeList() {
			const { result: res } = await appointmentList();
			this.typeList = res
			console.log(res);
		}
	}
};
</script>

<style>
.page {
	width: 100%;
	height: 100%;
	background-color: #ffffff;
	padding: 0 20rpx;
}
</style>
